import axios from "axios";
import qs from 'qs'
import { message } from "antd";
import _ from '../common/utils'

const http= axios.create({
    baseURL:'/api',
    timeout:60000

});

http.defaults.transformRequest=data=>{
    if(_.isPlainObject(data)) data=qs.stringify(data);
    return data;
}
http.interceptors.response.use(response=>{
    return response.data;
},reason=>{
    message.error("当前网络繁忙,请稍后再试");
    return Promise.reject(reason)
});
export default http;